#!/bin/bash

function site_all() {
	for tgz in `ls $DIR`
	do
		cd /tmp
		SITENAME=`echo $tgz | cut -d '-' -f 1`
	
		echo "Importing $SITENAME $tgz"
		/vagrant/sitescripts/site_prepare.sh $SITENAME $DIR/$tgz $PLATFORM
		
		#echo "Screenshot"
		#/vagrant/sitescripts/site_shot.sh $SITENAME
	done
	
	/etc/init.d/apache2 reload
}

if [ $# -eq 2 ]
then
	DIR=$1
	PLATFORM=$2
	site_all
else
	echo "Usage: site_prepare_all.sh <site_export_dir> <platform>"
	exit -1
fi